package com.example.exception;

import com.example.common.ErrorCode;
import com.example.common.Result;
import org.springframework.web.bind.annotation.ExceptionHandler;
import org.springframework.web.bind.annotation.RestControllerAdvice;

/**
 * @author: 临晖
 * @since: 2024-04-01
 */

@RestControllerAdvice
public class GlobalExceptionHandler {


    @ExceptionHandler(BusinessException.class)
    public Result buinessExceptionHandler(BusinessException be) {
        return Result.error(be.getMessage(), be.getCode());
    }


}
